﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
//using System.Xml.Linq;
using System.Data;
using Telerik.Web.UI;
using KPIS.Utils;
using KPIS.DBM;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.BLL;
using KPIS.GERP.GHRMS.MODEL;

namespace KPIS.GERP.GHRMS.APP.App_UI.Forms
{
    public partial class DC_Complains : System.Web.UI.Page
    {
        private SsMng ssMng = new SsMng();
        private DisciplinComplainBLL BLL = new DisciplinComplainBLL();

        protected void Page_Load(object sender, EventArgs e)
        {
            IncludeJava();

            if (!Page.IsPostBack)
            {
                LoadDataGrid();
            }  
        }
        public void LoadDataGrid()
        {
            DataTable dt = BLL.Select().Tables[0].Copy();

            RadGrid2.DataSource = dt;
            RadGrid2.DataBind();
        }
        public void IncludeJava()
        {
            HtmlGenericControl script = new HtmlGenericControl();
            script.TagName = "script";
            script.Attributes.Add("type", "text/javascript");
            script.Attributes.Add("src", "../../Scripts/jsfunction.js");
            Page.Header.Controls.Add(script);
        }
        protected void RadGrid2_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                int seq = Convert.ToInt32((e.Item as GridDataItem).OwnerTableView.DataKeyValues[e.Item.ItemIndex]["cmp_seq"]);
                BLL.Delete(seq, ssMng.EmpSeqI);
            }
            else if (e.CommandName == "btnClick")
            {
                return;
            }
            LoadDataGrid();
        }
    }
}
